﻿Public Class Form1
    Dim imgNo As Integer

    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
        Timer1.Enabled = True
    End Sub

    Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
        Timer1.Enabled = False
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        imgNo += 1
        If imgNo > ImageList1.Images.Count - 1 Then
            imgNo = 0
        End If
        PictureBox1.Image = ImageList1.Images(imgNo)
        PictureBox1.Left += tbrDistance.Value
        If PictureBox1.Left > Me.Width Then
            PictureBox1.Left = -PictureBox1.Width
        End If
    End Sub

    Private Sub tbrInterval_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbrInterval.Scroll
        lblInterval.Text = tbrInterval.Value
        Timer1.Interval = tbrInterval.Value
    End Sub

    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbrDistance.Scroll
        lblDistance.Text = tbrDistance.Value
    End Sub
End Class
